/**
 * @ Author: luoqi
 * @ Create Time: 2024-04-17 18:02
 * @ Modified by: luoqi
 * @ Modified time: 2024-10-12 00:51
 * @ Description:
 */

#ifndef _QBOOT_H
#define _QBOOT_H

#include <stdint.h>
#include "qboot_cfg.h"

typedef struct {
    int (*send)(const uint8_t *buf, uint32_t len);
    int (*recv)(uint8_t *buf, uint32_t len, uint32_t timeout_ms);
    int (*flash_write)(uint32_t addr, const uint8_t *data, int len);
    int (*flash_erase)(uint32_t addr, int len);
} QBoot;

int qboot_init( int (*send)(const uint8_t *, uint32_t), 
                int (*recv)(uint8_t *, uint32_t, uint32_t),
                int (*flash_write)(uint32_t, const uint8_t *, int),
                int (*flash_erase)(uint32_t, int));

int qboot_exec();

int qboot_jump(uint32_t addr);

#endif
